Ext.define('ExtAppSystem.view.systemManagement.UserGridPanel', {
    extend: 'Ext.window.Window',
    alias: 'widget.userGridPanel',
    id: 'usergridpanel',
    store: 'systemManagement.UserGridStore',

	height: 560,
	width: 800,
	title: '用户管理',
	closeAction: 'hide',
		
    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
        	items:[{
        		xtype:'gridpanel',
        		margin: '5 0 5 5',
         	   	columns: [
           	       {
                    xtype: 'gridcolumn',
                    hidden: true,
                    width: 46,
                    
                    dataIndex: 'id',
                    text: 'id'
                	},
                	{
                    xtype: 'gridcolumn',
                    
                    dataIndex: 'userCode',
                    text: '用户编号'
                	},
                	{
                    xtype: 'gridcolumn',
                    
                    dataIndex: 'userName',
                    text: '用户名称'
               		},
                	{
                    xtype: 'gridcolumn',
                    
                    dataIndex: 'department ',
                    text: '部  门'
                	},
                	{
                    xtype: 'gridcolumn',
                    
                    dataIndex: 'phone',
                    text: '电  话'
                	},
                	{
                    xtype: 'gridcolumn',
                    
                    dataIndex: 'mobilePhone',
                    text: '移动电话'
                	},
                	{
                    xtype: 'gridcolumn',
                    width: 173,
                    
                    dataIndex: 'emailAddress',
                    text: 'Email地址'
                	},
                	{
                    xtype: 'gridcolumn',
                    width: 40,
                    align: 'center',
                    fixed: true,
                    dataIndex: 'state',
                    text: '状  态'
                	}
            	]
            }],
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
                            xtype: 'cycle',
                            iconCls: 'application_form_magnify',
                            showText: true,
                            width: 120,
                            menu: {
                                xtype: 'menu',
                                width: 120,
                                items: [
                                    {
                                        xtype: 'menucheckitem',
                                        text: '用户名称'
                                    },
                                    {
                                        xtype: 'menucheckitem',
                                        text: '用户编号'
                                    },
                                    {
                                        xtype: 'menucheckitem',
                                        text: '状态'
                                    }
                                ]
                            }
                        },
                        {
                            xtype: 'textfield',
                            name: 'queryCondition'
                        },
                        {
                            xtype: 'button',
                            action: 'sreach',
                            iconCls: 'icon-seach',
                            text: '查  询'
                        },
                        {
                            xtype: 'button',
                            iconCls: 'icon-more-seach',
                            text: '高级查询'
                        },
                        {
                            xtype: 'tbseparator'
                        },
                        {
                            xtype: 'button',
                            action:'new',
                            text: '新  建'
                        },
                        {
                            xtype: 'button',
                            action:'modify',
                            text: '修  改'
                        },
                        {
                            xtype: 'button',
                            action: 'delete',
                            text: '删  除'
                        },
                        {
                            xtype: 'tbseparator'
                        },
                        {
                            xtype: 'button',
                            text: '角色设置'
                        }
                    ]
                },
                {
                    xtype: 'pagingtoolbar',
                    dock: 'bottom',
                    width: 360,
                    displayInfo: true,
                    store: 'systemManagement.UserGridStore'
                }
            ],
            listeners: {
                afterrender: {
                    fn: me.loadDataAfterRender,
                    scope: me
                }
            }
        });

        me.callParent(arguments);
    },
    loadDataAfterRender: function(component, options) {
		component.down('gridpanel').store.load();
    }, 
    createWindow : function(){
    	return this;
    }

});